<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="node_modules/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
    <ul>
        <li v-for="item in arr">
            {{item.name}}
        </li>
    </ul>
<!--    添加自定义参数-->
    <button @click="doit('name')">点击</button>
    <!--    事件修饰符  限制触发案件是回车-->
    <input type="text" @keyup.enter="sayHi">

</div>
<script>
    var app = new Vue({
        el:"#app",
        data:{
            arr:[{"name":"jack"},{"name":"tom"}]
        },
        methods:{
            doit:function (name) {
                this.arr.push({"name":name})
            },
            sayHi:function () {
                alert("hello")
            }
        }
    });

</script>
</body>
</html>